package com.atl.controller.wx.admin;

import com.atl.common.BaseResponse;
import com.atl.common.ErrorCode;
import com.atl.constant.UserConstant;
import com.atl.enity.po.StockUser;
import com.atl.enity.wx.admin.vo.StockUserListVO;
import com.atl.enity.wx.user.dto.StockUserLoginDTO;
import com.atl.service.IStockUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author: 临晖
 * @since: 2024-06-26
 */

@RestController
@RequestMapping("/wx/admin/stock-user")
@Slf4j
@Api(tags = "客户管理")
public class WXStcokUserController {



    @Resource
    private IStockUserService stockUserService;


    /**
     *
     * 退出登录
     *
     * @param request
     * @return
     */
    @PostMapping("/list")
    @ApiOperation("客户信息")
    public BaseResponse<List<StockUserListVO>> outLogin(HttpServletRequest request) {
        List<StockUser> list = stockUserService.list();

        List<StockUserListVO> res = list.stream()
                .map(obj -> {
                    StockUserListVO listVO = new StockUserListVO();
                    BeanUtils.copyProperties(obj, listVO);
                    return listVO;
                }).collect(Collectors.toList());
        return BaseResponse.okResult(res);
    }
}